﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace PropertyManagment.entity {

    /// <summary>
    /// 菜单实体类
    /// </summary>
    [Table("sys_menu")]
    public class SysMenu : BaseEntity {

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime created { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? updated { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        [Required]
        public int statu { get; set; }

        /// <summary>
        /// 父菜单ID，一级菜单为0
        /// </summary>
        [Required(ErrorMessage = "上级菜单不能为空")]
        public long parent_id { get; set; }

        /// <summary>
        /// 菜单名
        /// </summary>
        [Required(ErrorMessage = "菜单名称不能为空")]
        public String name { get; set; }

        /// <summary>
        /// 菜单URL
        /// </summary>
        public String path { get; set; }

        /// <summary>
        /// 授权(多个用逗号分隔，如：user:list,user:create)
        /// </summary>
        [Required(ErrorMessage = "菜单授权码不能为空")]
        public String perms { get; set; }

        /// <summary>
        /// 组件
        /// </summary>
        public String component { get; set; }

        /// <summary>
        /// 类型 0：目录 1：菜单 2：按钮
        /// </summary>
        [Required(ErrorMessage = "菜单类型不能为空")]
        public int type { get; set; }

        /// <summary>
        /// 菜单图标
        /// </summary>
        public String icon { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int orderNum { get; set; }

        /// <summary>
        /// 子菜单
        /// </summary>
        public List<SysMenu> children = new List<SysMenu>();
    }
}
